﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormProject.Diger
{
    public partial class SubelerList : Form
    {
        public SubelerList()
        {
            InitializeComponent();
        }
        DBBaglantiDataContext db = new DBBaglantiDataContext();
        public Form AcanForm = null;
        private void SubelerList_Load(object sender, EventArgs e)
        {
            GrdSubelist.DataSource = (from x in db.Subelers join y in db.Sehirlers on x.SubeSehirID equals y.SehirID join z in db.Ilcelers on x.SubeIlceID equals z.IlceID select new { x.SubeID, x.SubeAdi,y.SehirAdi,z.IlceAdi}).ToList();

        }

        private void GrdSubelist_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (AcanForm.Name == "Subelerfrm")
            {
                Subelerfrm frm = Application.OpenForms["Subelerfrm"] as Subelerfrm;
                if (frm != null)
                {
                    frm.SubeAdi.Text = GrdSubelist.Rows[e.RowIndex].Cells[1].Value.ToString();
                    frm.SubeGetir();
                    this.Close();
                }
            
            }
        }
    }
}
